<div class="Item hr">
    <span class="fr">系统现有数据模型<b>{$models_count}</b>个</span>
    <div class="current">数据模型列表</div>
</div>
<form>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
        <thead>
            <tr>
                <td>模型名（表名）</td>
                <td>菜单名</td>
                <td>模型字段数</td>
                <td>模型记录行数</td>
                <td>内部表</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            <volist name="models" id="model">
            <tr align="center">
                <td>{$model['name']}（{$model['tbl_name']}）</td>
                <td>{$model['menu_name']}</td>
                <td>{$model['fields_count']}</td>
                <td>{$model['rows']}</td>
                <td><if condition="$model['is_inner'] == 1">是<else/>否</if></td>
                <td>[ <a href="{:U('Models/show', array('id' => $model['id']))}">查看</a> ] [ <a href="{:U('Models/edit', array('id' => $model['id']))}">编辑</a> ] [ <a href="javascript:void(0);" value="{:U('Models/delete', array('id' => $model['id']))}" name="{$model['name']}({$model['tbl_name']})" class="del">删除</a> ]</td>
            </tr>
            </volist>
        </tbody>
    </table>
</form>

<div class="page">
    {$page}
</div>

<script type="text/javascript">
$(function(){
    $(".del").click(function(){
        var del_link = $(this).attr("value");
        popup.confirm('你真的打算删除 <b>'+ $(this).attr("name")+'</b> 吗?','温馨提示',function(action){
            if(action == 'ok'){
                $.getJSON(del_link, function(json){
                    if (json.status) {
                        popup.success(json.info);
                        setTimeout(function(){
                            popup.close("asyncbox_success");
                        },2000);
                    } else {
                        popup.error(json.info);
                        setTimeout(function(){
                            popup.close("asyncbox_error");
                        },2000);
                    }

                    setTimeout(function(){
                        top.window.location.reload();
                    },1000);
                });
            }
        });

        return false;
    });
});
</script>
